package windows;



import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.WindowConstants;

import coordinators.Cordinator;

public class ManageOrder extends JFrame 
{
	Cordinator coordinator;
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private ManageOrderCreate 	manageOrderCreate;
	private ManageOrderModify 	manageOrderModify;
	private ManageOrderDelete	manageOrderDelete;
	private ManageOrderShow 	manageOrderShow;

	private JTabbedPane panels;
	

	public ManageOrder(WindowPrincipal top)
	{
		super();
		setLayout(null);
		setSize(500,600);

	
		panels=new JTabbedPane();

		panels.setBounds(0,0,getWidth(),getHeight());

		manageOrderCreate=new ManageOrderCreate();
		manageOrderCreate.setBounds(0,0,getWidth(),getHeight());
		manageOrderCreate.setPreferredSize(manageOrderCreate.getSize());

		manageOrderModify =new ManageOrderModify();
		manageOrderModify .setBounds(0,0,getWidth(),getHeight());

		manageOrderDelete=new ManageOrderDelete();
		manageOrderDelete.setBounds(0,0,getWidth(),getHeight());

		manageOrderShow=new ManageOrderShow();
		manageOrderShow.setBounds(0,0,getWidth(),getHeight());

		panels.addTab("Crear Pedido",manageOrderCreate);
		panels.addTab("Modificar Pedido", manageOrderModify);
		panels.addTab("Eliminar Pedido", manageOrderDelete);
		panels.addTab("Mostrar Pedido", manageOrderShow);

		getContentPane().add(panels);
		setTitle("Gestionar Pedido");
		setLocation(250, 100);
		setResizable(false);
		
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		this.addWindowListener(new WindowListener() 
		{
	        public void windowClosed(WindowEvent arg0) 
	        {
	        	manageOrderCreate.clean();
	        	/*manageInsumosDelete.clean();
	        	manageInsumosModify.clean();
	        	manageInsumosShow.clean();*/
	            coordinator.ProcessCloseManageInsumos();
	        }
	        public void windowClosing(WindowEvent arg0) 
	        {
	        }
			public void windowActivated(WindowEvent e) 
			{
			}
			public void windowDeactivated(WindowEvent e) 
			{
			}
			public void windowDeiconified(WindowEvent e) 
			{
			}
			public void windowIconified(WindowEvent e) 
			{
			}
			public void windowOpened(WindowEvent e) 
			{
			}
		});
	}
	

	public void setCoordinador(Cordinator c)
	{
		coordinator = c;
	}

	
}
